<%--
  @author Duminda Dharmakeerthi
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript">
    $(document).ready(function() {
        $("#kmlDocumentUpload").hide();

        var mode = document.getElementById("edit_mode").value;
        if (mode == 2 || mode == 3 || mode == 4 || mode == 5 || mode == 6 || mode == 8 || mode == 9) {
            var fieldIds = new Array('submitDate', 'departmentName', 'departmentAddress',
                    'departmentMobileId', 'departmentLandPhoneId', 'departmentEmailId', 'departmentFaxId',
                    'contactPersonId', 'designationId', 'personMobileId', 'personLandPhoneId',
                    'personEmailId', 'personFaxId', 'planNoId', 'lotNoId', 'hectareId', 'acreId', 'roodsId', 'perchesId', 'alienationMethodId5', 'alienationMethodId6', 'purposeId');
            enableFields(fieldIds);
            $("#attachFile").hide();

        } else {

            var pls_enter_department_name = "<br>" + document.getElementById("pls_enter_department_name").value;
            var pls_enter_department_address = "<br>" + document.getElementById("pls_enter_department_address").value;
            var pls_enter_submit_date = "<br>" + document.getElementById("pls_enter_submit_date").value;
            var pls_enter_contact_person = "<br>" + document.getElementById("pls_enter_contact_person").value;

            $("#gov-land-init-ReleseToDepartment-application-form").validate({
                rules: {
                    departmentName: {
                        required: true
                    },
                    submitDate:{
                        required:true
                    },
                    departmentAddress:{
                        required:true
                    },
                    contactPersonName:{
                        required:true
                    }
                },
                messages: {
                    departmentName: {
                        required:pls_enter_department_name
                    },
                    submitDate:{
                        required:pls_enter_submit_date
                    },
                    departmentAddress:{
                        required:pls_enter_department_address
                    },
                    contactPersonName:{
                        required:pls_enter_contact_person
                    }
                }
            });
        }
      /*  if (mode == 3 || mode == 4 || mode == 6) {
            showLandDetails();
            $('#landDetails').hide();
            $('a[rel*=facebox]').facebox(function() {
                $('#landDetails').show();
            });
        }*/
    });
</script>
<div id="land-registration-module-home-title" class="module-home-title">
    <s:include value="../alienationApplicationNavigationDetail.jsp"/>
</div>

<div id="init-release-to-departments-application-outer" class="form-outer">
    <h2>Detailed Land Application - Releasing to Institutes</h2>
    <hr/>
    <s:form method="POST" id="gov-land-init-ReleseToDepartment-application-form" onsubmit="selectList()"
            enctype="multipart/form-data">
        <fieldset class="submit-date-fieldset-style">
            <table class="submited-date-table">
                <tr>
                    <td><s:label value="%{getText('submit_date.label')}" cssClass="mandatory-field"/><s:label
                            value="%{getText('date_format.label')}" cssClass="date-format"/></td>
                    <td><s:textfield id="submitDate" name="landApplication.submitDate"/></td>
                </tr>
                <tr>
                    <td><s:label value="Alienation Method" cssClass="mandatory-field"/></td>
                    <td>
                        <s:radio id="alienationMethodId" list="alienationMethodSet" name="alienationType"/>
                    </td>
                </tr>
                    <%-- <tr>
                      <td><s:label value="%{getText('alienation_methods.label')}" cssClass="mandatory-field"/></td>
                      <td><s:checkboxlist list="alienationMethodSet" name="alienationMethodSelectedList"
                                          value="amSelectedList" theme="checkbox-theme"/></td>
                  </tr>  --%>
            </table>
        </fieldset>
        <div id="tabs">
            <ul>
                <li><s:a href="#departmentDetails"><s:label
                        value="%{getText('details_of_department.label')}"/></s:a></li>
                <li><s:a href="#contactPersonDetail"><s:label
                        value="%{getText('details_of_contact_person.label')}"/></s:a></li>
                <li><s:a href="#landAlienationDetails"><s:label value="%{getText('details_of_land.label')}"/></s:a></li>
                <li><s:a href="#otherDetails"><s:label value="%{getText('other_details.label')}"/></s:a></li>
            </ul>

            <div class="fieldset-style" id="departmentDetails">
                <table class="width-100">
                    <tr>
                        <td><s:label value="%{getText('name_of_the_Department.label')}" cssClass="mandatory-field"/>
                        </td>
                        <td colspan="3"><s:textarea name="contactPerson.name" cssClass="width-500-px"
                                                    id="departmentName"/></td>
                    </tr>
                    <tr>
                        <td><s:label value="%{getText('address_of_the_department.label')}" cssClass="mandatory-field"/>
                        </td>
                        <td colspan="3"><s:textarea cssClass="width-500-px" name="contactPerson.address"
                                                    id="departmentAddress"/></td>
                    </tr>
                    <tr>
                        <td><s:label value="%{getText('telephone.label')}"/></td>
                        <td><s:label value="%{getText('mobile.label')}"/></td>
                        <td colspan="2"><s:textfield name="contactPerson.mobile" id="departmentMobileId"/></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><s:label value="%{getText('land_phone.label')}"/></td>
                        <td colspan="2"><s:textfield name="contactPerson.landPhone" id="departmentLandPhoneId"/>
                        </td>
                    </tr>
                    <tr>
                        <td><s:label value="%{getText('email.label')}"/></td>
                        <td><s:textfield name="contactPerson.email" id="departmentEmailId"/></td>
                        <td><s:label value="%{getText('fax.label')}"/></td>
                        <td><s:textfield name="contactPerson.fax" id="departmentFaxId"/></td>
                    </tr>
                </table>
            </div>
            <div class="fieldset-style" id="contactPersonDetail">
                <table>
                    <tr>
                        <td><s:label value="%{getText('name.label')}" cssClass="mandatory-field"/></td>
                        <td colspan="3">
                            <s:textarea name="holder.name" cssClass="width-500-px" id="contactPersonId"/>
                        </td>
                    </tr>
                    <tr>
                        <td><s:label value="%{getText('designation.label')}"/></td>
                        <td colspan="3"><s:textarea name="holder.designation" cssClass="width-500-px"
                                                    id="designationId"/></td>
                    </tr>
                    <tr>
                        <td><s:label value="%{getText('telephone.label')}"/></td>
                        <td><s:label value="%{getText('mobile.label')}"/></td>
                        <td colspan="2"><s:textfield name="contacts.mobile" id="personMobileId"/></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><s:label value="%{getText('land_phone.label')}"/></td>
                        <td colspan="2"><s:textfield name="contacts.landPhone" id="personLandPhoneId"/></td>
                    </tr>
                    <tr>
                        <td><s:label value="%{getText('email.label')}"/></td>
                        <td><s:textfield name="contacts.email" id="personEmailId"/></td>
                        <td><s:label value="%{getText('fax.label')}"/></td>
                        <td><s:textfield name="contacts.fax" id="personFaxId"/></td>
                    </tr>
                </table>
            </div>
            <div class="fieldset-style" id="landAlienationDetails">
                <table>
                    <tr>
                        <td><s:label value="%{getText('plan_no.label')}"/></td>
                        <td><s:textfield name="landApplication.planNo" id="planNoId"/></td>
                        <td><s:label value="%{getText('lot_no.label')}"/></td>
                        <td><s:textfield name="landApplication.lotNo" id="lotNoId"/></td>
                    </tr>
                    <tr>
                        <td><s:label value="%{getText('required_extent.label')}"/></td>
                        <td colspan="3">
                            <table>
                                <tr>
                                    <td><s:label value="%{getText('hectare_label')}"/></td>
                                    <td colspan="5"><s:textfield name="landApplication.landExpectedExtent"
                                                                 cssClass="width-120-px"
                                                                 id="hectareId"/></td>
                                </tr>
                                <tr>
                                    <td><s:label value="%{getText('acre.label')}"/></td>
                                    <td><s:textfield cssClass="width-120-px" id="acreId"/></td>
                                    <td><s:label value="%{getText('roods.label')}"/></td>
                                    <td><s:textfield cssClass="width-120-px" id="roodsId"/></td>
                                    <td><s:label value="%{getText('perches.label')}"/></td>
                                    <td><s:textfield cssClass="width-120-px" id="perchesId"/></td>
                                </tr>
                            </table>
                        </td>

                    </tr>
                </table>
            </div>
            <div class="fieldset-style" id="otherDetails">
                <table class="width-100">
                    <tr>
                        <td><s:label value="%{getText('purpose_of_the_requesting_land')}"/></td>
                        <td colspan="3"><s:textarea cssClass="width-610-px" name="landApplication.purpose"
                                                    id="purposeId"/></td>
                    </tr>
                </table>
            </div>
            <table>
                <tr>
                    <td align="left-align"><s:include value="../../documentUploadTemp.jsp"/></td>
                </tr>
            </table>
        </div>
        <hr/>
        <s:hidden name="alienationType"/>
        <s:include value="buttons.jsp"/>
    </s:form>
</div>
<%--<div id="landDetails" style="width: 780px;">
</div>--%>
<s:hidden id="edit_mode" name="editMode"/>
<s:hidden id="pls_enter_department_name" value="%{getText('pls_enter_department_name')}"/>
<s:hidden id="pls_enter_submit_date" value="%{getText('pls_enter_submit_date')}"/>
<s:hidden id="pls_enter_department_address" value="%{getText('pls_enter_department_address')}"/>
<s:hidden id="pls_enter_contact_person" value="%{getText('pls_enter_contact_person')}"/>